package cloudInformation.service.impl;

import cloudEntity.entity.SmartUserClassEntity;
import cloudEntity.leftJoin.ClassPersonLeftJoin;
import cloudEntity.vo.PageBeanVO;
import cloudEntity.vo.news.SmartNewsVO;
import cloudEntity.vo.user.SmartUserClassVO;
import cloudInformation.mapper.SmartUserClassMapper;
import cloudInformation.service.SmartUserClassService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @program: Smart School
 * @ClassName SmartUserClassServiceImpl
 * @description:
 * @author: 陈智博
 * @create: 2025-04-14 08:31
 * @Version 1.0
 **/
@Service
public class SmartUserClassServiceImpl implements SmartUserClassService {

    @Autowired
    private SmartUserClassMapper smartUserClassMapper;

    @Override
    public PageBeanVO<SmartUserClassVO> GetClassByPage(String className, Integer pageNum, Integer pageSize) {
        Integer pageBean = (pageNum - 1) * pageSize;
        Integer countSize = smartUserClassMapper.GetClassCount();
        List<SmartUserClassVO> smartNewsDTOS = smartUserClassMapper.GetClassReturnPage(className,pageBean,pageSize);
        return new PageBeanVO<>(pageNum,pageSize,countSize,smartNewsDTOS);
    }

    @Override
    public PageBeanVO<ClassPersonLeftJoin> GetClassPersonByPage(String personName,Integer classId, Integer pageNum, Integer pageSize) {
        Integer pageBean = (pageNum - 1) * pageSize;
        Integer countSize = smartUserClassMapper.GetClassPersonCount(personName,classId);
        List<ClassPersonLeftJoin> classPersonLeftJoins = smartUserClassMapper.GetCLassPersonReturnPage(personName,classId,pageBean,pageSize);
        return new PageBeanVO<>(pageNum,pageSize,countSize,classPersonLeftJoins);
    }
}
